package cn.car.schedule;

import cn.car.domains.entity.VehicleEntryExitInfoEntity;
import cn.car.service.VehicleEntryExitInfoService;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
@Slf4j
public class VehicleInfoSchedule {

    @Resource
    private VehicleEntryExitInfoService vehicleEntryExitInfoService;

    //@Scheduled(cron = "0 30 * * * ? ")  // 每30分钟运行一次
    //@Scheduled(fixedRate = 1,timeUnit = TimeUnit.MINUTES)
    public void compensateVehicleInfoUploadStatus() {

        DateTime startTime = DateUtil.offset(new Date(), DateField.HOUR_OF_DAY, -24);
        DateTime endTime = DateUtil.offset(new Date(), DateField.MINUTE, -30);
        List<VehicleEntryExitInfoEntity> vehicleEntryExitInfoEntityList = vehicleEntryExitInfoService.compensateVehicleInfoUploadStatus(startTime, endTime);
    }
}
